<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Offices extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	 
	var $c_name = '中心概况';
	
	public function index()
	{
		$data['page_title'] = $this->c_name;
		$data['offices'] = $this->Office->get_last_n_entries();
		
		$this->load->view('header', $data);	
		$this->load->view('sidebar_office');		
		$this->load->view('office');
		$this->load->view('footer');
	}
	
	public function item($id)
	{
		$ee = $this->Office->get_entrie($id);
		$data['office'] = $ee[0];		
		$data['offices'] = $this->Office->get_last_n_entries();
		
		if (count($ee) > 0) {
			$data['news'] = $ee[0];
		} else {
			$data['page_title'] = 'Not found';
			$this->load->view('header', $data);	
			$this->load->view('contact');
			$this->load->view('sidebar');
			$this->load->view('footer');
			return;
		}
		
		$data['page_title'] = $data['office']->OrgName;
		$data['up_cate'] = $this->c_name;
		$this->load->view('header', $data);	
		$this->load->view('sidebar_office');		
		$this->load->view('office_single');
		$this->load->view('footer');
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */